<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
<input type="text" v-model="num1">
<input type="text" v-model="num2">
<input type="button" value="加" @click="f('+')">
<input type="button" value="减" @click="f('-')">
<input type="button" value="乘" @click="f('*')">
<input type="button" value="除" @click="f('/')">
<h1>结果:{{info}}</h1>
</div>
<script src="js/vue.min.js"></script>
<script>
    let v = new Vue({
        el:"body>div",
        data:{
            info:"",
          num1:"",
          num2:""
        },
        methods:{
            f(x){
                switch (x){
                    case "+":
                        v.info = v.num1*1+v.num2*1
                        break
                    case "-":
                        v.info = v.num1-v.num2
                        break
                    case "*":
                        v.info = v.num1*v.num2
                        break
                    case "/":
                        if(v.num2==0){
                            v.info="除数不能为0"
                        }else {
                            v.info = v.num1/v.num2
                            break
                        }
                }
            }
        }
    })
</script>
</body>
</html>